#ifndef PARSING_H
#define PARSING_H

#include <QWidget>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsItem>

QT_BEGIN_NAMESPACE
namespace Ui {
class parsing;
}
QT_END_NAMESPACE

class parsing : public QWidget
{
    Q_OBJECT

public:
    parsing(QWidget *parent = nullptr);
    ~parsing();

private slots:
    void on_openFile_clicked();

    void on_saveAsFile_clicked();

    void on_minimizeDFA_clicked();

    void on_printDFA_clicked();

    void on_printNFA_clicked();

    void on_startAnalysis_clicked();

    void on_showMinDFAGraph_clicked();

    void on_showDFAGraph_clicked();

private:
    Ui::parsing *ui;
    void drawDFAGraph(bool isMinimized = false);  // 画DFA图
    void drawState(QGraphicsScene* scene, int x, int y, QString label, bool isStart, bool isAccept);  // 画状态
    void drawTransition(QGraphicsScene* scene, QPointF start, QPointF end, QString label);  // 画转换
    
    QGraphicsScene* scene = nullptr;
    QGraphicsView* view = nullptr;
};
#endif // PARSING_H
